import os
import unittest
from datetime import datetime

from BeautifulReport import BeautifulReport

if __name__ == '__main__':
    case_path = os.path.join(os.getcwd(), 'testcase')
    test_suite = unittest.defaultTestLoader.discover(
        case_path,
        pattern='Opengauss_Function_*.py')
    result = BeautifulReport(test_suite)
    report_path = os.path.join(os.getcwd(), 'report')
    now_t = datetime.now().strftime('%Y%d%m_%H%M%S')
    result.report(filename=f'一体化平台自动化测试报告_{now_t}',
                  description='一体化平台自动化测试报告',
                  report_dir=report_path)
